package com.dingwei.lesyndrome.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.dingwei.lesyndrome.R;
import com.dingwei.lesyndrome.bean.MyNewsBean;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;
import com.jude.easyrecyclerview.adapter.RecyclerArrayAdapter;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created time 2018/2/26.
 * Creator 南柯一梦丶 on
 * Personal signature 余生还长 何必慌张
 * Page description :
 */

public class MyNewAdapter extends RecyclerArrayAdapter<MyNewsBean.DataBean> {
    public MyNewAdapter(Context context) {
        super(context);
    }

    @Override
    public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) {
        return new MyNewsHolder(parent);
    }

    public class MyNewsHolder extends BaseViewHolder<MyNewsBean.DataBean> {

        @Bind(R.id.tv_title)
        TextView tvTitle;
        @Bind(R.id.tv_time)
        TextView tvTime;
        @Bind(R.id.tv_content)
        TextView tvContent;
        @Bind(R.id.is_see)
        View isSee;

        public MyNewsHolder(ViewGroup parent) {
            super(parent, R.layout.item_my_news);
            ButterKnife.bind(this, itemView);


        }

        @Override
        public void setData(MyNewsBean.DataBean data) {
            super.setData(data);

            tvTitle.setText(data.title);
            tvTime.setText(data.showTime);
            tvContent.setText(data.brief);
            if (data.issee == 0) {
                isSee.setVisibility(View.VISIBLE);
            }else {
                isSee.setVisibility(View.INVISIBLE);
            }

        }
    }
}
